home *** CD-ROM | disk | FTP | other *** search
- I rather often want to look at a file on a remote system, and either
- absorb the information that's in the file with my own eyes or
- send it off to a printer or some other kind of single-use thing.
- For these purposes the idiom of
- vget foo
- less foo
- rm foo
- is kind of tiresome.
-
- FTP is actually reasonable in handling this idiom; if you
- invoke it roughly as follows. The "-i" flag inhibits all of
- the status messages et al, so what you get is the file on
- standard out. so you have "ftpcat host /pub/foo | more"
- and you're set.
-
- It appears the the "-i" flag's processing has been taken out
- of vget. (I don't have the ftp client sources handy to see
- what all it did.) My first approach to building a "vcat"
- is to take ftp.c and ensure that all of the status messages,
- "500 command not understood" reports, and the like were sent
- to stderr instead of stdout. then vcat is merely
-
- vget $1 - 2>/dev/null
-
- (i.e. get rid of stderr) and you can say
-
- vcat /archive-sites/dec.com/pub/maps/letter/s-michigan.ps | lpr
-
- i.e. get rid of stderr. It messes up real error messages
- though, so if the file really is not found it's not the
- right thing to do.
-
- Diffs available upon request; they are entirely mechanical,
- just finding all printf() and turning into fprintf(stderr),
- and all putchar() into putc(c,stderr).
-
- --Ed
- Edward Vielmetti
- emv@msen.com
-
- #!/bin/sh
- # ftpcat
- # usage: ftpcat host.domain.org /pub/README
- #
- ftp -i $1 <<EOF
- binary
- get $2 |cat
- EOF
-
-